
let nodeFs = require('fs/promises')
let nodePath = require('path');
// const fs = require("fs");

// console.log(fs.constants.COPYFILE_EXCL)

let nodeApi={
  fs:nodeFs,
  path:nodePath,
}
// window.nodeApi = nodeApi


async function getRuleExecPlugins(pluginPath){
  let pluginDir = nodePath.normalize(pluginPath)
  let subDirs = await nodeFs.readdir(pluginDir)

  let pluginList = subDirs.map(subDir=>{
    let pp = nodePath.join(pluginPath,subDir)
    let plugin = require(pp)
    return plugin
  })
  console.log(pluginList)
  return pluginList
}

getRuleExecPlugins("D:\\project\\fileauto-tool\\plugins")
